const TOKEN_KEY = 'token'

export const setToken = (tokenValue) => {
  const tokenValueJson = JSON.stringify(tokenValue)
  localStorage.setItem(TOKEN_KEY, tokenValueJson)
}

export const getToken = () => {
  try {
    const tokenValueJson = localStorage.getItem(TOKEN_KEY)
    return JSON.parse(tokenValueJson)
  } catch (error) {
    console.log(error)
  }
}

export const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY)
}